import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'
import Download from '../views/Download.vue'
import Friend from '../views/Friend.vue'
import MyMusic from '../views/MyMusic.vue'
import Shop from '../views/Shop.vue'
import dHome from '../views/discover/Home.vue'
import Album from '../views/discover/Album.vue'
import dArtist from '../views/discover/Artist.vue'
import Djradio from '../views/discover/Djradio.vue'
import PlayList from '../views/discover/Playlist.vue'
import HPlayList from '../views/playList.vue'
import TopList from '../views/discover/Toplist.vue'
import Song from '../views/song.vue'
import Songer from '../views/songer.vue'
import HAlbum from '../views/album.vue'
import AAlbum from '../views/artist/album.vue'
import Ainfo from '../views/artist/info.vue'
import Amv from '../views/artist/mv.vue'
import songermu from '../views/artist/songermu.vue'

const routes = [
  {
    path: '/Home', component: Home, children: [
      // 子节点路由不用/前缀
      { path: '', component: dHome },
      { path: 'toplist', component: TopList },
      { path: 'playList', component: PlayList },
      { path: 'Djradio', component: Djradio },
      { path: 'artist', component: dArtist },
      { path: 'album', component: Album },
    ]
  },
  { path: '/download', component: Download },
  { path: '/friend', component: Friend },
  { path: '/mymusic', component: MyMusic },
  { path: '/shop', component: Shop },
  { path: '/playlist', component: HPlayList },
  { path: '/song', component: Song },
  {
    path: '/songer', component: Songer, children: [
      { path: 'songermu', component: songermu },
      { path: 'Aablum', component: AAlbum },
      { path: 'mv', component: Amv },
      { path: 'info', component: Ainfo }
    ], redirect: '/songer/songermu'
  },
  { path: '/album', component: HAlbum },
  { path: '/', redirect: '/Home' }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
